﻿using System.IO;
using Newtonsoft.Json.Linq;
using SpriteAtlasRuntime;

namespace AnimationPackerEngine.Animation.CommandWriters
{
    internal class Goto : ICommandWriter
    {
        private string mLabel;

        internal Goto(string label)
        {
            mLabel = label;
        }

        internal Goto(JValue value)
            : this(value.Value as string)
        {
        }

        public void Write(BinaryWriter binaryWriter, IWriterContext context)
        {
            binaryWriter.Write((int)ScriptCommands.Goto);
            binaryWriter.Write(mLabel);
        }
    }
}
